import random
number=random.randint(0, 100)
guess=None
money=5000
while money > 0:
    guess = int(input("猜一个数字 ："))
    if guess < number:
        print("小了")
        money-=500
    elif guess > number:
        print("大了")
        money-=500
    elif guess == number:
        print("恭喜你猜对了")
        money+=3000
        print("您的余额为：", money)
        go = input("是否进行下一轮游戏：")
        if go=='是'or"yes":
            number = random.randint(0, 100)
        else:
            break
    elif money<=0:
        print("余额不足")
        break
print("游戏结束，您的余额为：",money)



